local joy__fanxiang = fk.CreateSkill {

  name = "joy__fanxiang",

  tags = { Skill.Wake, },

}



joy__fanxiang:addEffect(fk.EventPhaseStart, {
  name = "joy__fanxiang",
  frequency = Skill.Wake,
  events = {fk.EventPhaseStart},
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(joy__fanxiang.name) and
      player.phase == Player.Start and
      player:usedSkillTimes(joy__fanxiang.name, Player.HistoryGame) == 0
  end,
  can_wake = function(self, event, target, player, data)
    return player:usedSkillTimes("joy__liangzhu", Player.HistoryGame) > 0
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    room:changeMaxHp(player, 1)
    if player:isWounded() then
      room:recover({
        who = player,
        num = 1,
        recoverBy = player,
        skillName = joy__fanxiang.name
      })
    end
    room:handleAddLoseSkills(player, "xiaoji|joy__wujian", nil)
  end,
})

return joy__fanxiang